﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="H2.NET.Web.Pages.SMD.InStock.Index" %>
<%@ Import Namespace="H2.NET.Common" %>
<%@ Import Namespace="H2.NET.Web.Pages.SMD.Model" %>

<script type="text/javascript">
    function StockMaintain() {
        $.pdialog.open("pages/smd/InStock/StockMaintain.aspx", "StockMaintain", "库存维护", { width: 860, height: 556, mask: true });
        return false;
    }
    function BudgetMaintain() {
        $.pdialog.open("pages/smd/InStock/BudgetMaintain.aspx", "BudgetMaintain", "设备预算维护", { width: 450, height: 300, mask: true });
        return false;
    }
</script>

<div class="pageContent">
    <div class="panelBar" style="border-top:0;">
        <ul class="toolBar">
            <li><a class="stock" href="javascript:void(0);" onclick="return StockMaintain();"><span>库存维护</span></a></li>
            <li><a class="budget" href="javascript:void(0);" onclick="return BudgetMaintain();"><span>设备预算维护</span></a></li>
        </ul>
    </div>
	<div class="tabs" style="margin:5px;">
		<div class="tabsHeader">
			<div class="tabsHeaderContent">
				<ul>
					<li><a href="javascript:;"><span>上海</span></a></li>
					<li><a href="javascript:;"><span>广州</span></a></li>
					<li><a href="javascript:;"><span>廊坊</span></a></li>
					<li><a href="pages/smd/InStock/logs.aspx?category=kc" class="j-ajax"><span>库存变更日志</span></a></li>
                    <li><a href="pages/smd/InStock/logs.aspx?category=ys" class="j-ajax"><span>设备预算变更日志</span></a></li>
				</ul>
			</div>
		</div>
		<div class="tabsContent" style="padding:0;">
			<div>
			    <table class="list" style="width:100%;" layoutH="142">
                    <thead>
                        <tr>
                            <th style="width:15%;text-align:center;">设备分类</th>
                            <th style="width:15%;text-align:center;">设备型号</th>
                            <th style="width:10%;text-align:center;">现有库存</th>
                            <th style="width:10%;text-align:center;">发机数</th>
                            <th style="width:10%;text-align:center;">最多还可购买</th>
                            <th style="width:10%;text-align:center;">设备单价</th>
                            <th style="width:30%;text-align:center;">备注</th>
                        </tr>
                    </thead>
                    <tbody>
                    <%
                        var gInStocks = InStocks.Where(t=>t.Area == "上海").GroupBy(t => t.GroupName).ToList();
                        foreach (IGrouping<string, t_smd_InStock> group in gInStocks)
                        {
                            %> 
                        <tr>
                            <td style="background:#eee;text-align:left;"><%=group.Key%></td>
                            <td style="background:#eee;" colspan="6"></td>
                        </tr>
                        <% foreach (var inStock in group)
                           { %>
                        <tr style="background:#fff;">
                            <td>&nbsp;</td>
                            <td style="text-align:left;"><%= inStock.Name %></td>
                            <td style="text-align:center;"><%= inStock.InitQuantity %></td>
                            <td style="text-align:center;"><%= inStock.SendQuantity %></td>
                            <td style="text-align:center;"><%= inStock.Price == 0 ? 0 : Utils.StrToInt(BalanceBudget_SH.Replace(",",""),0)/(int)inStock.Price %></td>
                            <td style="text-align:right;"><%= inStock.Price.ToString("N") %></td>
                            <td style="text-align:left;"><%= inStock.Remark %></td>
                        </tr>
                    <%      }
                        }   %>
                        <tr>
                            <td colspan="7" style="text-align:right;background:#eee;">
                                现有预算：<span id="now" style="font-style:italic"><%=BalanceBudget_SH%></span>
                            </td>
                        </tr>
                    </tbody>
                </table>
			</div>
            <div>
                <table class="list" style="width:100%;" layoutH="142">
                    <thead>
                        <tr>
                            <th style="width:15%;text-align:center;">设备分类</th>
                            <th style="width:15%;text-align:center;">设备型号</th>
                            <th style="width:10%;text-align:center;">现有库存</th>
                            <th style="width:10%;text-align:center;">发机数</th>
                            <th style="width:10%;text-align:center;">最多还可购买</th>
                            <th style="width:10%;text-align:center;">设备单价</th>
                            <th style="width:30%;text-align:center;">备注</th>
                        </tr>
                    </thead>
                    <tbody>
                    <%
                        gInStocks = InStocks.Where(t => t.Area == "广州").GroupBy(t => t.GroupName).ToList();
                        foreach (IGrouping<string, t_smd_InStock> group in gInStocks)
                        {
                            %> 
                        <tr>
                            <td style="background:#eee;text-align:left;"><%=group.Key%></td>
                            <td style="background:#eee;" colspan="6"></td>
                        </tr>
                        <% foreach (var inStock in group)
                           { %>
                        <tr style="background:#fff;">
                            <td>&nbsp;</td>
                            <td style="text-align:left;"><%= inStock.Name %></td>
                            <td style="text-align:center;"><%= inStock.InitQuantity %></td>
                            <td style="text-align:center;"><%= inStock.SendQuantity %></td>
                            <td style="text-align:center;"><%= inStock.Price == 0 ? 0 : Utils.StrToInt(BalanceBudget_GZ.Replace(",",""),0)/(int)inStock.Price %></td>
                            <td style="text-align:right;"><%= inStock.Price.ToString("N") %></td>
                            <td style="text-align:left;"><%= inStock.Remark %></td>
                        </tr>
                    <%      }
                        }   %>
                        <tr>
                            <td colspan="7" style="text-align:right;background:#eee;">
                                现有预算：<span id="now" style="font-style:italic"><%=BalanceBudget_GZ%></span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div>
                <table class="list" style="width:100%;" layoutH="142">
                    <thead>
                        <tr>
                            <th style="width:15%;text-align:center;">设备分类</th>
                            <th style="width:15%;text-align:center;">设备型号</th>
                            <th style="width:10%;text-align:center;">现有库存</th>
                            <th style="width:10%;text-align:center;">发机数</th>
                            <th style="width:10%;text-align:center;">最多还可购买</th>
                            <th style="width:10%;text-align:center;">设备单价</th>
                            <th style="width:30%;text-align:center;">备注</th>
                        </tr>
                    </thead>
                    <tbody>
                    <%
                        gInStocks = InStocks.Where(t => t.Area == "廊坊").GroupBy(t => t.GroupName).ToList();
                        foreach (IGrouping<string, t_smd_InStock> group in gInStocks)
                        {
                            %> 
                        <tr>
                            <td style="background:#eee;text-align:left;"><%=group.Key%></td>
                            <td style="background:#eee;" colspan="6"></td>
                        </tr>
                        <% foreach (var inStock in group)
                           { %>
                        <tr style="background:#fff;">
                            <td>&nbsp;</td>
                            <td style="text-align:left;"><%= inStock.Name %></td>
                            <td style="text-align:center;"><%= inStock.InitQuantity %></td>
                            <td style="text-align:center;"><%= inStock.SendQuantity %></td>
                            <td style="text-align:center;"><%= inStock.Price == 0 ? 0 : Utils.StrToInt(BalanceBudget_LF.Replace(",",""),0)/(int)inStock.Price %></td>
                            <td style="text-align:right;"><%= inStock.Price.ToString("N") %></td>
                            <td style="text-align:left;"><%= inStock.Remark %></td>
                        </tr>
                    <%      }
                        }   %>
                        <tr>
                            <td colspan="7" style="text-align:right;background:#eee;">
                                现有预算：<span id="now" style="font-style:italic"><%=BalanceBudget_LF%></span>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div id="kc"></div>
            <div id="ys"></div>
		</div>
		<div class="tabsFooter">
			<div class="tabsFooterContent"></div>
		</div>
	</div>
</div>
